//
//  UIImage+ADUtil.h
//  ADKit
//
//  Created by duzexu on 2017/12/1.
//  Copyright © 2017年 duzexu. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, UIImageGradientType) {
    UIImageGradientTop2Bottom = 0, //上到下
    UIImageGradientLeft2Right, //左到右
    UIImageGradientLeftCorner2RightCorner, //左上角到右下角
};

@interface UIImage (ADUtil)

- (UIImage *)ad_templateImage;

- (UIImage *)ad_originalImage;

- (UIImage *)ad_resizableImage;

- (UIImage *)ad_resizableImageWithCapInsets:(UIEdgeInsets)capInsets;

+ (UIImage *)ad_imageNamed:(NSString *)name inBundle:(NSBundle *)bundle;

- (UIImage *)ad_compressBelowMaxLength:(NSUInteger)maxLength;

- (UIImage *)ad_scaleToScale:(float)scale;

// 修改大图片size
- (UIImage *)ad_scaleImageWithData:(NSData *)data withSize:(CGSize)size scale:(CGFloat)scale orientation:(UIImageOrientation)orientation;

// 生成渐变图
+ (UIImage *)ad_gradientImageWithSize:(CGSize)size andColors:(NSArray*)colors andGradientType:(UIImageGradientType)gradientType;
+ (UIImage *)ad_gradientImageWithSize:(CGSize)size center:(CGPoint)center radius:(CGFloat)radius andColors:(NSArray*)colors;
// 某个像素点的颜色
- (UIColor *)ad_colorAtPixel:(CGPoint)point;

- (UIImage *)ad_imageByApplyingAlpha:(CGFloat)alpha;

@end
